package exception;

import java.io.FileOutputStream;

public class FinallyDemo2 {
    public static void main(String[] args) {
        FileOutputStream fos = null;
        try{
            fos = new FileOutputStream("fos.txt");
            fos.write(97);
        }catch(Exception e){
            System.out.println("出错了");
        }finally{
            System.out.println("进入finally");
            try{
                if(fos != null){
                    fos.close();
                }
            }catch(Exception e){
                System.out.println("关闭出错");
            }
        }
    }
}
